package com.pifuke.patient;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import cn.o.app.event.listener.OnSelectedChangeListener;
import cn.o.app.io.Extra;
import cn.o.app.ui.OStateViewFrame;
import cn.o.app.ui.OTab;

import com.smiier.skin.net.SymptomPatientTask.SymptomItemInfo;
import com.smiier.skin.net.SymptomPatientTask.SymptomPatientItem;
import com.smiier.skin.ui.BasicActivity;
import com.smiier.skin.util.GlobalSettings;
import com.umeng.analytics.MobclickAgent;

/**
 * 科普页
 * 
 * @author Administrator
 *
 */
public class SymptomActivity extends BasicActivity {

	protected OStateViewFrame mFrame;
	protected OTab mTab;
	

	public static class SymptomExtra extends Extra {
		public String symptom;
	}

	protected SymptomExtra mExtra;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.activity_symptom);

		init();

		mExtra = new SymptomExtra();
		if (mExtra.getFrom(this.getIntent())) {
			this.setNavTitle(mExtra.symptom);
		}
		
		/**
		 * 过滤数据
		 */
		
		for(SymptomPatientItem item : SkinApp.Symptoms){
			
			for(int i = 0; i < item.Symptoms.size(); i++){
				SymptomItemInfo data = item.Symptoms.get(i);
				
				if(data.Patient_Name.equals(mExtra.symptom)){
				   GlobalSettings.symptomItemInfo = data;
				}
				
			}
			
		}
		

		mFrame = findViewById(R.id.frame, OStateViewFrame.class);

		mFrame.setSelectedIndex(0);
		
		mTab = this.findViewById(R.id.tab_bar, OTab.class);
		mTab.setSelectedIndex(0);
		
		mTab.setOnSelectedChangeListener(new OnSelectedChangeListener() {
			
			@Override
			public void onChanged(View v, int index) {
				switch (index) {
				case 0:
					mFrame.setSelectedIndex(index);
					break;
					
				case 1:
					mFrame.setSelectedIndex(index);
					break;
					
				case 2:
					mFrame.setSelectedIndex(index);
					break;

				default:
					break;
				}
				
			}
		});
	}
	
/*	
	@Override
	protected void onResume() {
		super.onResume();
		MobclickAgent.onResume(this);
	}

	@Override
	protected void onPause() {
		super.onPause();
		
		MobclickAgent.onPause(this);
	}*/
	
}
